var numJson = [{
	key: 0,
	children: [{
		key: 2,
		children: [{
			key: 0
		}]
	}, {
		key: 10
	}, {
		key: 12,
		children: [{
			key: 25,
			children: [{
				key: 0
			}]
		}]
	}]
}, {
	key: 3,
	children: [{
		key: 4,
		children: [{
			key: 5,
			children: [{
				key: 7
			}]
		}, {
			key: 51,
			children: [{
				key: 27
			}]
		}, {
			key: 15,
			children: [{
				key: 72
			}]
		}]
	}]
}]

function getMaxNum(arr, num) {
	let max = num ? num : -1
	if (!(arr instanceof Array)) {
		return max
	}
	
	for (let i = 0; i < arr.length; i++) {
		max = Math.max(arr[i].key, max)
		max = arr[i].key >= max ? arr[i].key : max
		if (arr[i].children instanceof Array) {
			max = getMaxNum(arr[i].children, max)
		}
	}
	
	return max
}


console.log(getMaxNum(numJson))
